package com.wangjie.simple;

/**
 * @author jieshao
 * @date 2022/5/31 10:03
 *
 * 1844. 将所有数字用字符替换
 */
public class Test15 {
    public static void main(String[] args) {
        String s = "a1c1e1";
        String res = replaceDigits(s);
        System.out.println(res);
    }

    public static String replaceDigits(String s) {
        char[] arr = s.toCharArray();
        for (int i = 1; i < arr.length; i += 2) {
            arr[i] = (char) (arr[i - 1] + arr[i] - '0');
        }
        return new String(arr);
    }
}